package extension

class StringPrefLazy(private val num: Int) : Lazy<String> {
    private var cached: String? = null

    override val value: String
        get() = if (cached == null) {
            num.toString().also { cached = it }
        } else {
            cached!!
        }

    /**
     * @return lazy是否初始化
     */
    override fun isInitialized() = cached != null
}